<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content=
    "application/xhtml+xml; charset=iso-8859-1" />
    <title>
      Lua-5.3.5
    </title>
    <link rel="stylesheet" type="text/css" href="../stylesheets/lfs.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="stylesheet" href="../stylesheets/lfs-print.css" type=
    "text/css" media="print" />
  </head>
  <body class="blfs" id="blfs-2020-04-02">
    <div class="navheader">
      <h4>
        Beyond Linux<sup>�</sup> From Scratch <span class="phrase">(System
        V</span> Edition) - Version 2020-04-02
      </h4>
      <h3>
        Chapter&nbsp;13.&nbsp;Programming
      </h3>
      <ul>
        <li class="prev">
          <a accesskey="p" href="llvm.html" title="LLVM-10.0.0">Prev</a>
          <p>
            LLVM-10.0.0
          </p>
        </li>
        <li class="next">
          <a accesskey="n" href="lua52.html" title="Lua-5.2.4">Next</a>
          <p>
            Lua-5.2.4
          </p>
        </li>
        <li class="up">
          <a accesskey="u" href="prog.html" title=
          "Chapter&nbsp;13.&nbsp;Programming">Up</a>
        </li>
        <li class="home">
          <a accesskey="h" href="../index.html" title=
          "Beyond Linux� From Scratch     (System V Edition) - Version 2020-04-02">
          Home</a>
        </li>
      </ul>
    </div>
    <div class="sect1" lang="en" xml:lang="en">
      <h1 class="sect1">
        <a id="lua" name="lua"></a>Lua-5.3.5
      </h1>
      <div class="package" lang="en" xml:lang="en">
        <h2 class="sect2">
          Introduction to Lua
        </h2>
        <p>
          <span class="application">Lua</span> is a powerful light-weight
          programming language designed for extending applications. It is
          also frequently used as a general-purpose, stand-alone language.
          <span class="application">Lua</span> is implemented as a small
          library of C functions, written in ANSI C, and compiles unmodified
          in all known platforms. The implementation goals are simplicity,
          efficiency, portability, and low embedding cost. The result is a
          fast language engine with small footprint, making it ideal in
          embedded systems too.
        </p>
        <p>
          This package is known to build and work properly using an LFS-9.1
          platform.
        </p>
        <h3>
          Package Information
        </h3>
        <div class="itemizedlist">
          <ul class="compact">
            <li class="listitem">
              <p>
                Download (HTTP): <a class="ulink" href=
                "http://www.lua.org/ftp/lua-5.3.5.tar.gz">http://www.lua.org/ftp/lua-5.3.5.tar.gz</a>
              </p>
            </li>
            <li class="listitem">
              <p>
                Download MD5 sum: 4f4b4f323fd3514a68e0ab3da8ce3455
              </p>
            </li>
            <li class="listitem">
              <p>
                Download size: 300 KB
              </p>
            </li>
            <li class="listitem">
              <p>
                Estimated disk space required: 4.5 MB (with Basic tests)
              </p>
            </li>
            <li class="listitem">
              <p>
                Estimated build time: less than 0.1 SBU (with Basic tests)
              </p>
            </li>
          </ul>
        </div>
        <h3>
          Additional Downloads
        </h3>
        <div class="itemizedlist">
          <ul class="compact">
            <li class="listitem">
              <p>
                Required patch: <a class="ulink" href=
                "http://www.linuxfromscratch.org/patches/blfs/svn/lua-5.3.5-shared_library-1.patch">
                http://www.linuxfromscratch.org/patches/blfs/svn/lua-5.3.5-shared_library-1.patch</a>
              </p>
            </li>
            <li class="listitem">
              <p>
                Optional Test Suite Download (HTTP): <a class="ulink" href=
                "http://www.lua.org/tests/lua-5.3.4-tests.tar.gz">http://www.lua.org/tests/lua-5.3.4-tests.tar.gz</a>
              </p>
            </li>
            <li class="listitem">
              <p>
                Optional Test Suite Download MD5 sum:
                b14fe3748c1cb2d74e3acd1943629ba3
              </p>
            </li>
            <li class="listitem">
              <p>
                Optional Test Suite Download size: 104 KB
              </p>
            </li>
          </ul>
        </div>
        <p class="usernotes">
          User Notes: <a class="ulink" href=
          "http://wiki.linuxfromscratch.org/blfs/wiki/lua">http://wiki.linuxfromscratch.org/blfs/wiki/lua</a>
        </p>
      </div>
      <div class="installation" lang="en" xml:lang="en">
        <h2 class="sect2">
          Installation of Lua
        </h2>
        <p>
          Some packages check for the <span class=
          "application">pkg-config</span> file for <span class=
          "application">Lua</span>, which is created with:
        </p>
        <pre class="userinput">
<kbd class="command">cat &gt; lua.pc &lt;&lt; "EOF"
<code class="literal">V=5.3
R=5.3.5

prefix=/usr
INSTALL_BIN=${prefix}/bin
INSTALL_INC=${prefix}/include
INSTALL_LIB=${prefix}/lib
INSTALL_MAN=${prefix}/share/man/man1
INSTALL_LMOD=${prefix}/share/lua/${V}
INSTALL_CMOD=${prefix}/lib/lua/${V}
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: Lua
Description: An Extensible Extension Language
Version: ${R}
Requires:
Libs: -L${libdir} -llua -lm -ldl
Cflags: -I${includedir}</code>
EOF</kbd>
</pre>
        <p>
          Install <span class="application">Lua</span> by running the
          following commands:
        </p>
        <pre class="userinput">
<kbd class=
"command">patch -Np1 -i ../lua-5.3.5-shared_library-1.patch &amp;&amp;
sed -i '/#define LUA_ROOT/s:/usr/local/:/usr/:' src/luaconf.h &amp;&amp;

make MYCFLAGS="-DLUA_COMPAT_5_2 -DLUA_COMPAT_5_1" linux</kbd>
</pre>
        <p>
          To test the results, issue: <span class="command"><strong>make
          test</strong></span>. <span class="quote">&ldquo;<span class=
          "quote">This will run the interpreter and print its
          version.</span>&rdquo;</span>. More comprehensive tests can be
          performed if you downloaded the "Test suite" tarball. Those tests
          need to be executed after the package is installed, thus we defer
          to the description below.
        </p>
        <p>
          Now, as the <code class="systemitem">root</code> user:
        </p>
        <pre class="root">
<kbd class="command">make INSTALL_TOP=/usr                \
     INSTALL_DATA="cp -d"            \
     INSTALL_MAN=/usr/share/man/man1 \
     TO_LIB="liblua.so liblua.so.5.3 liblua.so.5.3.4" \
     install &amp;&amp;


mkdir -pv                      /usr/share/doc/lua-5.3.5 &amp;&amp;
cp -v doc/*.{html,css,gif,png} /usr/share/doc/lua-5.3.5 &amp;&amp;

install -v -m644 -D lua.pc /usr/lib/pkgconfig/lua.pc</kbd>
</pre>
        <p>
          Here we describe only the "Basic tests". Untar the tarball and
          change to the <code class="filename">lua-5.3.4-tests</code>
          directory, then issue <span class="command"><strong>lua -e
          "_U=true" all.lua</strong></span>. If the tests finish without
          error, you will see a message containing the string "final OK".
        </p>
      </div>
      <div class="commands" lang="en" xml:lang="en">
        <h2 class="sect2">
          Command Explanations
        </h2>
        <p>
          <span class="command"><strong>sed -i ...
          src/luaconf.h</strong></span>: This command changes the
          <span class="application">Lua</span> search path to match the
          install path.
        </p>
        <p>
          <code class="envar">MYCFLAGS="-DLUA_COMPAT_5_2
          -DLUA_COMPAT_5_1"</code>: This environment variable includes
          compatibility layers with Lua 5.1 and 5.2 in the build.
        </p>
      </div>
      <div class="content" lang="en" xml:lang="en">
        <h2 class="sect2">
          Contents
        </h2>
        <div class="segmentedlist">
          <div class="seglistitem">
            <div class="seg">
              <strong class="segtitle">Installed Programs:</strong>
              <span class="segbody">lua and luac</span>
            </div>
            <div class="seg">
              <strong class="segtitle">Installed Library:</strong>
              <span class="segbody">liblua.so</span>
            </div>
            <div class="seg">
              <strong class="segtitle">Installed Directories:</strong>
              <span class="segbody">/usr/{lib,share}/lua and
              /usr/share/doc/lua-5.3.5</span>
            </div>
          </div>
        </div>
        <div class="variablelist">
          <h3>
            Short Descriptions
          </h3>
          <table border="0" class="variablelist">
            <colgroup>
              <col align="left" valign="top" />
              <col />
            </colgroup>
            <tbody>
              <tr>
                <td>
                  <p>
                    <a id="lua-prog" name="lua-prog"></a><span class=
                    "term"><span class=
                    "command"><strong>lua</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is the standalone Lua interpreter.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="luac" name="luac"></a><span class=
                    "term"><span class=
                    "command"><strong>luac</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is the Lua compiler.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="liblua" name="liblua"></a><span class=
                    "term"><code class="filename">liblua.so</code></span>
                  </p>
                </td>
                <td>
                  <p>
                    contains the <span class="application">Lua</span> API
                    functions.
                  </p>
                </td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
      <p class="updated">
        Last updated on 2020-03-12 04:24:44 -0500
      </p>
    </div>
    <div class="navfooter">
      <ul>
        <li class="prev">
          <a accesskey="p" href="llvm.html" title="LLVM-10.0.0">Prev</a>
          <p>
            LLVM-10.0.0
          </p>
        </li>
        <li class="next">
          <a accesskey="n" href="lua52.html" title="Lua-5.2.4">Next</a>
          <p>
            Lua-5.2.4
          </p>
        </li>
        <li class="up">
          <a accesskey="u" href="prog.html" title=
          "Chapter&nbsp;13.&nbsp;Programming">Up</a>
        </li>
        <li class="home">
          <a accesskey="h" href="../index.html" title=
          "Beyond Linux� From Scratch     (System V Edition) - Version 2020-04-02">
          Home</a>
        </li>
      </ul>
    </div>
  </body>
</html>
